import  turtle as tu
import datetime


def tuinit():
    tu.setup(900, 500)
    tu.pensize(6)
    tu.penup()
    tu.left(180)
    tu.fd(350)
    tu.right(180)
    tu.pendown()
    tu.hideturtle()

def getTime():
    now = datetime.datetime.now().strftime("%Y-%m-%d")
    timelist = now.split("-")
    tuinit()
    drawDate(timelist)
    tu.done()

def drawDate(a):
    colors = ["red","yellow","green"]
    for i in range(0,len(a)):
        tu.color(colors[i])
        for j in a[i]:
            drawNum(int(j))
            tu.right(180)
            tu.penup()
            tu.fd(20)
            tu.pendown()
        if i==0:
            tu.write("年",move=False,align='center',font=('arial',8,'normal'))
        if i==1:
            tu.write("月", move=False, align='center', font=('arial', 8, 'normal'))
        if i==2:
            tu.write("日", move=False, align='center', font=('arial', 8, 'normal'))
        tu.penup()
        tu.fd(10)
        tu.pendown()


def drawNum(num):
    drawLine(True) if num in [2,3,4,5,6,8,9] else drawLine(False)
    drawLine(True) if num in [0,1,3,4,5,6,7,8,9] else drawLine(False)
    drawLine(True) if num in [0,2,3,5,6,8] else drawLine(False)
    drawLine(True) if num in [0,2,6,8] else drawLine(False)
    tu.left(90)
    drawLine(True) if num in [0,4,6,8,9] else drawLine(False)
    drawLine(True) if num in [0,2,3,5,7,8,9] else drawLine(False)
    drawLine(True) if num in [0,1,2,3,4,7,8,9] else drawLine(False)

def drawLine(flag):
    tu.penup()
    tu.fd(2)
    if not flag:
        tu.penup()
        tu.fd(36)
    else:
        tu.pendown()
        tu.fd(36)
    tu.penup()
    tu.fd(2)
    tu.right(90)


getTime()
